package Function;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class FCMutilPlayTimeSyncHelper {
    private static FCMutilPlayTimeSyncHelper helper;
    private ConcurrentHashMap<String, Long> timeMap = new ConcurrentHashMap<>();
    static {
        helper = new FCMutilPlayTimeSyncHelper();
    }

    public static FCMutilPlayTimeSyncHelper getInstance(){
        return helper;
    }


    public long getLastSyncTime(String key){
        Long ret = timeMap.get(key);
        if(ret == null)
            return 0;
        return ret;
    }


    public void saveNewSyncTime(String key, long time){
        timeMap.put(key, time);
       // System.out.println("size "+timeMap.size());
    }

    public static void main(String[] args) {
        FCMutilPlayTimeSyncHelper.getInstance().saveNewSyncTime("3333", 33);
        FCMutilPlayTimeSyncHelper.getInstance().saveNewSyncTime("44", 334);
        FCMutilPlayTimeSyncHelper.getInstance().saveNewSyncTime("3333", 55);
        FCMutilPlayTimeSyncHelper.getInstance().saveNewSyncTime("44", 335664);
        System.out.println("=="+FCMutilPlayTimeSyncHelper.getInstance().getLastSyncTime("44"));
    }
}
